<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
	第<input type="text" id="row"/>行,第<input type="text" id="col"/>列
	<input type="button" onclick="del();" value="删除第i列第j行"/><br />
	<table id="test" border="1px solid black;" style="width:500px;">
		<caption>疯狂Java体系</caption>
		<tr>
			<td>疯狂Java讲义</td>
			<td>轻量级Java EE企业应用实战</td>
		</tr>
		<tr>
			<td>疯狂Java讲义</td>
			<td>轻量级Java EE企业应用实战</td>
		</tr>
		<tr>
			<td>疯狂Java讲义</td>
			<td>轻量级Java EE企业应用实战</td>
		</tr>
	</table>
	<script type="text/javascript">
		let tab = document.getElementById("test");
		
		let del = function(){
			
			let row = document.getElementById("row").value;
			var col = document.getElementById("col").value;
			var rowList = tab.rows;
			
			if(row==""||col==""){
				alert("不可为空");
			}
			
			if(isNaN(row)){
				alert("行输入不规范");
				return false;
			}
			if(isNaN(col)){
				alert("列输入不规范");
				return false;
			}
			if(row > rowList.length||row<0){
				alert("不存在该行");
				return false;
			}
			
			let delrow = rowList.item( row - 1);
			let cols = tab.rows[row-1].cells.length;
			if(col > cols || col<0){
				alert("不存在该列");
				return false;
			}
			delrow.deleteCell(col-1);
		}
	</script>
</body>
</html>